<template>
	<view class="index">
		<view :class="'header ' + (banertrue ? 'header_lan' : '')" :style="'padding-top: ' + navH + 'px;'">
			<view class="header_height" :style="'height:' + gaodu + 'px;line-height:' + gaodu + 'px;top:' + gaodutops + 'px;'">
				<view class="index_h_cont3">
					<view class="index_wenben_img" @tap="jumpzuo"><image :src="imgUrl + '/dzx_img22.png'" mode="widthFix"></image></view>
					<view class="index_wenben baise">{{ $t('page_my_shenqingdf.Application_payment') }}</view>
				</view>
			</view>
			<view class="coloe_title">s</view>
		</view>
		<view class="index_banner" style="position: absolute; background: #fff"><image :src="imgUrl + '/dzx_img148.png'" mode="widthFix"></image></view>

		<view class="index_center" :style="'padding-top:' + (navH + 50) + 'px;'">
			<view class="my_shenqingcy_input">
				<view class="my_shenqingcy_inputs">
					<image :src="imgUrl + '/dzx_img149.png'"></image>
					<input type="text" placeholder="请输入快递单号" @confirm="keywordFun" />
				</view>
			</view>
			<view class="mys_shenqingcy_list" v-if="arrlist.length != 0">
				<view class="mys_shenqingcy_cont" v-for="(item, index) in arrlist" :key="index">
					<view class="mys_shenqingcy_cont_title">
						<view class="mys_shenqingcy_cont_l">
							<image :src="imgUrl + '/dzx_img27.png'"></image>
							<text>{{ $t('page_my_shenqingdf.parcel_no') }}：{{ item.express_num }}</text>
						</view>
					</view>

					<view class="mys_shenqingcy_cont_dis">
						<view class="mys_shenqingcy_cont_t1">{{ $t('page_my_shenqingdf.shipping_country') }}：{{ item.country.title }}</view>
						<view class="mys_shenqingcy_cont_t1">{{ $t('page_my_shenqingdf.Item_information') }}：{{ item.class_name }}</view>
						<view class="mys_shenqingcy_cont_t1">{{ $t('page_my_shenqingdf.reporting_time') }}：{{ item.created_time }}</view>
					</view>

					<view class="mys_shenqingcy_cont_bottom">
						<view class="mys_shenqingcy_cont_b1">
							{{ $t('page_my_shenqingdf.total') }}：
							<text>{{ price_mode.unit }}{{ item.total_free }}</text>
						</view>
						<view class="mys_shenqingcy_cont_b2">{{ $t('page_my_shenqingdf.Application_payment') }}</view>
					</view>
				</view>
			</view>
			<view class="mys_shenqingcy_list" v-else>
				<view class="my_dingdan_zanwu">
					<image :src="imgUrl + '/dzx_img43.png'"></image>
					<text>{{ $t('page_my_shenqingdf.no_order_yet') }}</text>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
// pages/shouye/shouye_zkc/shouye_zkc.js
const app = getApp();

let request = require('../../../utils/require');

export default {
	data() {
		return {
			navH: app.globalData.navHeight,
			gaodu: app.globalData.height,
			gaodutops: app.globalData.top,
			imgUrl: app.globalData.imgUrl,
			price_mode: uni.getStorageSync('price_mode'),
			banertrue: false,
			//分页
			page: 1,
			ispage: true,
			arrlist: [],
			keyword: ''
		};
	}, //滑动显示顶部
	onPageScroll: function(e) {
		if (e.scrollTop > this.navH + 50) {
			this.banertrue= true
		} else {
			this.banertrue= false
		}
	},
	/**
	 * 生命周期函数--监听页面加载
	 */
	onLoad() {
		var that = this;
	},
	onShow() {
		var that = this;
		that.shenqingdaif();
	},
	/**
	 * 生命周期函数--监听页面初次渲染完成
	 */
	onReady: function() {},
	/**
	 * 生命周期函数--监听页面隐藏
	 */
	onHide: function() {},
	/**
	 * 生命周期函数--监听页面卸载
	 */
	onUnload: function() {},
	/**
	 * 页面相关事件处理函数--监听用户下拉动作
	 */
	onPullDownRefresh: function() {},
	/**
	 * 页面上拉触底事件的处理函数
	 */
	onReachBottom: function() {
		if (this.ispage) {
			this.page= this.page
			this.shenqingdaif();
		}
	},
	/**
	 * 用户点击右上角分享
	 */
	onShareAppMessage: function() {},
	methods: {
		keywordFun(e) {
			this.keyword= e.detail.value
			this.page= 1
			this.ispage= true
			this.arrlist= []
			this.shenqingdaif();
		},

		//申请代付
		shenqingdaif() {
			var that = this;
			var data = {
				token: uni.getStorageSync('token'),
				page: that.page,
				keyword: that.keyword
			};
			request.post(`index.php?s=/api/package/nopay&wxapp_id=` + uni.getStorageSync('web_id'), data).then(res => {
				if (res.data.code == 1) {
					if (that.page > res.data.data.last_page) {
						that.ispage= false
					} else {
						console.log(that.arrlist, '????arrlist');
						that.arrlist= that.arrlist.concat(res.data.data.data)
					}
				}
			});
		},

		jumpzuo() {
			uni.navigateBack();
		}
	}
};
</script>
<style>
@import './my_shenqingdf.css';
</style>
